<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="/static/plugins/easyui/themes/material/easyui.css">
    <link rel="stylesheet" type="text/css" href="/static/plugins/easyui/themes/icon.css">
    <script type="text/javascript" src="/static/plugins/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="/static/plugins/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/static/plugins/easyui/jquery.edatagrid.js"></script>

    <script type="text/javascript" src="/static/plugins/easyui/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="/static/js/employeeInfo.js"></script>
    <script type="text/javascript" src="/static/js/workExperience.js"></script>

    <script type="text/javascript" src="/static/js/education.js"></script>
    <script type="text/javascript" src="/static/js/training.js"></script>
    <script type="text/javascript" src="/static/js/others.js"></script>
    <script type="text/javascript" src="/static/js/input_salary.js"></script>
    <script>
        $(function () {
            $('#tt9').edatagrid({
                url: '/familyCondition/selectAll.do',
                fit: true,
                fitColumns: true,
                toolbar: '#tb9',
                autoSave: true,
                saveUrl: '/familyCondition/saveOrUpdate.do',
                updateUrl: '/familyCondition/saveOrUpdate.do',
                destroyMsg: {
                    norecord: {
                        // 在没有记录选择的时候执行
                        title: '温馨提示',
                        msg: '请选中一行数据'
                    },
                    confirm: {
                        // 在选择一行的时候执行
                        title: '确认框',
                        msg: '你确定要删除这条数据吗?'
                    }
                },
                onDestroy: function (index, row) {
                    $.get('/familyCondition/delete.do', {id: row.id}, function (data) {
                        if (data.success) {
                            $.messager.alert("温馨提示", data.msg, 'info', function () {
                                $('#tt9').edatagrid('reload');
                            })
                        } else {
                            $.messager.alert("温馨提示", data.msg, 'warning')
                        }
                    })
                },
                onAdd: function (index, row) {
                    $.messager.alert("温馨提示", '已添加一行数据', 'info', function () {
                        $.get('/familyCondition/saveOrUpdate.do', {id: row.id}, function () {
                            $('#tt9').edatagrid('reload');
                        })
                    })
                }


            })
        })

        function add9() {
            console.log("sdf");
            $('#tt9').edatagrid('addRow');
        }

        function del9() {
            // 销毁所有选择的行
            $('#tt9').edatagrid('destroyRow');
        }


        function relo9() {
            $('#tt9').edatagrid('reload');
        }

    </script>

</head>

<body>
<table id="emp_datagrid"></table>
<!--表单按钮-->
<div id="tb">
    <div>
        工号<input class="easyui-textbox" name="workerNumber" prompt="请输入工号"/>
        姓名<input class="easyui-textbox" name="name" prompt="请输入姓名"/>
        聘用形式<input name="employment" class="easyui-combobox"
                   data-options="data:[{
                                                    'value':'0',
                                                    'text':'非合同'
                                                },{
                                                    'value':'1',
                                                    'text':'合同'
                                                }
                                               ],textField:'text',valueField:'value',panelHeight:'auto'">
        职务<input name="title" class="easyui-combobox"
                 data-options="data:[{
                                                    'value':'0',
                                                    'text':'老板'
                                                },{
                                                    'value':'1',
                                                    'text':'员工'
                                                }
                                               ],textField:'text',valueField:'value',panelHeight:'auto'">
        学历<input name="educationId"
                 class="easyui-combobox"
                 data-options="data:[{
                                                    'value':'0',
                                                    'text':'专科'
                                                },{
                                                    'value':'1',
                                                    'text':'本科'
                                                }
                                               ],textField:'text',valueField:'value',panelHeight:'auto'">
        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" data-cmd="query"></a>
    </div>

    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" data-cmd="add">新增</a>
    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true" data-cmd="edit">编辑</a>

    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" data-cmd="reload">刷新</a>
    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-redo',plain:true" data-cmd="exportXls">导出</a>

</div>


<div id="form_btn">
    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save',plain:true" data-cmd="save">保存</a>
    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" data-cmd="cancel">取消</a>
</div>

<div id="emp_dialog">
    <div id="tt" class="easyui-tabs" style="width:890px;height:420px">
        <div title="基本信息" style="margin-bottom: 15px;margin-top: 30px;margin: 15px ;margin-left: 30px">
            <form id="emp_form" method="post">
                <input type="hidden" name="employeeId" value="1">
                <input type="hidden" id="empId" name="id"/>
                <table align="center" style="border-collapse:separate; border-spacing:3px 15px;">
                    <tr>
                        <td>工号:</td>
                        <td><input name="workerNumber" class="easyui-textbox" prompt="请输入工号" style="margin: 15px"></td>
                        <td>部门:</td>
                        <td><input name="department.id" class="easyui-combobox"
                                   data-options="url:'/department/selectAll.do',textField:'name',valueField:'id',panelHeight:'auto'">
                        </td>
                    </tr>
                    <tr>
                        <td>姓名:</td>
                        <td><input name="name" class="easyui-textbox" prompt="请输入名字"></td>
                        <td>职务:</td>
                        <td><input name="title" class="easyui-combobox"
                                   data-options="data:[{
                                                    'value':'0',
                                                    'text':'老板'
                                                },{
                                                    'value':'1',
                                                    'text':'员工'
                                                }
                                               ],textField:'text',valueField:'value',panelHeight:'auto'"></td>
                    </tr>
                    <tr>
                        <td>聘用形式:</td>
                        <td><input name="employment" class="easyui-combobox"
                                   data-options="data:[{
                                                    'value':'0',
                                                    'text':'非合同'
                                                },{
                                                    'value':'1',
                                                    'text':'合同'
                                                }
                                               ],textField:'text',valueField:'value',panelHeight:'auto'"></td>

                        <td>学历:</td>
                        <td><input name="educationId"
                                   class="easyui-combobox"
                                   data-options="data:[{
                                                    'value':'0',
                                                    'text':'专科'
                                                },{
                                                    'value':'1',
                                                    'text':'本科'
                                                }
                                               ],textField:'text',valueField:'value',panelHeight:'auto'"></td>
                    </tr>
                    <tr>
                        <td>岗位:</td>
                        <td><input name="job" class="easyui-textbox"></td>

                        <td>电话:</td>
                        <td><input name="tel" class="easyui-textbox"></td>
                    </tr>

                    <tr>
                        <td>性别:</td>
                        <td><input name="gender" class="easyui-combobox"
                                   data-options="data:[{
                                                    'value':'0',
                                                    'text':'男'
                                                },{
                                                    'value':'1',
                                                    'text':'女'
                                                }
                                               ],textField:'text',valueField:'value',panelHeight:'auto'">

                        <td>年龄:</td>
                        <td><input name="age" class="easyui-textbox"></td>
                    </tr>
                    <tr>
                        <td>籍贯:</td>
                        <td><input name="national" class="easyui-textbox"></td>

                        <td>婚否:</td>
                        <td><input name="marryId" class="easyui-combobox"
                                   data-options="data:[{
                                                    'value':'0',
                                                    'text':'未婚'
                                                },{
                                                    'value':'1',
                                                    'text':'已婚'
                                                }
                                               ],textField:'text',valueField:'value',panelHeight:'auto'"></td>
                    </tr>
                    <tr>
                        <td>身份证号码:</td>
                        <td><input name="idcard" class="easyui-textbox"></td>
                        <td>生日:</td>
                        <td><input name="birthday" class="easyui-datebox"></td>
                    </tr>
                    <tr>
                        <td>地址:</td>
                        <td><input name="address" class="easyui-textbox"></td>
                    </tr>

                </table>
            </form>
        </div>
        <div title="工作经历">
            <table id="tt4" style="width:600px;height:200px"
                   singleSelect="true">
                <thead>
                <tr>
                    <th data-options="field:'workplace',editor:'text',width:50">工作单位</th>
                    <th data-options="field:'job',editor:'text',width:50">职位</th>
                    <th data-options="field:'duty',align:'right',editor:'text',width:50">职务</th>
                    <th data-options="field:'beginDate',align:'right',editor:'datebox',width:50">开始日期</th>
                    <th data-options="field:'endDate',editor:'datebox',width:50">结束日期</th>
                    <th data-options="field:'remark',align:'center',editor:'text',width:50">备注</th>
                </tr>
                </thead>
            </table>
        </div>
        <div title="工资信息">
            <%@include file="input_salary.jsp"%>
        </div>
        <div title="家庭情况">
            <%@include file="familyCondition.jsp" %>
        </div>
        <div title="教育情况">
            <%@include file="education.jsp" %>
        </div>
        <div title="培训情况">
            <%@include file="training.jsp"%>
        </div>
        <div title="其他情况">
            <%@include file="others.jsp"%>
        </div>
    </div>
    </form>
</div>
<div id="tb4">
    <a href="#" class="easyui-linkbutton"
       data-options="iconCls:'icon-add',plain:true" onclick="add4()">新增</a>
    <a href="#" class="easyui-linkbutton"
       data-options="iconCls:'icon-remove',plain:true" onclick="del4()">删除</a>
    <a href="#" class="easyui-linkbutton"
       data-options="iconCls:'icon-reload',plain:true" onclick="relo4()">刷新</a>
</div>
</body>
</html>
